<?php

namespace app\modules\api\controllers;

use Yii;
use app\modules\api\helper\UccHelper;
use app\modules\api\helper\Error;
use app\modules\api\exception\ApiException;

/**
 * Default controller for the `modules` module
 */
class UccController extends BaseController
{
    public function actionQuery($action = false)
    {
        if (!is_string($action) or empty($action)) {
            return Error::PARAM_EMPTY;
        }
        $uccHelper = new UccHelper();
        $ret = $uccHelper->$action(Yii::$app->request->post());
        if (false === $ret) {
            throw new ApiException($uccHelper->getErrMsg(), Error::DATA);
        }
        return $ret;
    }
}
